<?php
class files_controller extends controller {
  function resize() {
    $this->rendered = TRUE;
    $this->layout = FALSE;
    
    $url = $this->args[0];
    $geo = $this->args[1];
    $fname = $this->args[2];
    $src = 'files/' . $url . '/' . $fname;
    if (!file_exists($src)) {
      $src = 'files/cv8/foto.png';
    }
    $target = join('/', $this->path);
    
    $cmd = "convert $src -resize $geo $target";
    system($cmd);
    goto('/' . $target . '?' . filemtime($target));
  }

  function cv8() {
    error_log("files.cv8: " . json_encode($this->args));
  }
  
}
